//
//  AstProgram.inc.h
//  LightBasic
//
//  Created by Albert on 03/04/2011.
//  Copyright 2011 LightBasic Development Team. All rights reserved.
//
#pragma once


/// The AstDeclaration
struct AstDeclaration : Ast {};


/// the program root node
struct AstProgram : Ast
{
    /// Declaration container
    typedef std::vector<AstSourceUnit *> List;
    
    /// declarations
    List sources;
    
    /// Declare as ast node
    DECLARE_AST();
    
    /// Clean up
    virtual ~AstProgram()
    {
        for (List::iterator iter = sources.begin(); iter != sources.end(); iter++) {
            delete (Ast *)*iter;
        }
    }
};


/// The main ast node. Represents whol File
struct AstSourceUnit : Ast
{
    /// Declaration container
    typedef std::vector<AstDeclaration *> List;
    
    /// declarations
    List decls;
    
    /// Declare as ast node
    DECLARE_AST();
    
    /// Clean up
    virtual ~AstSourceUnit()
    {
        for (List::iterator iter = decls.begin(); iter != decls.end(); iter++) {
            delete *iter;
        }
    }
};
